/*+**************************************************************************/
/***                                                                      ***/
/***   Copyright (C) 2005-2006 by Dierk Ohlerich                          ***/
/***   all rights reserved                                                ***/
/***                                                                      ***/
/***   To license this software, please contact the copyright holder.     ***/
/***                                                                      ***/
/**************************************************************************+*/

asc
{
  cbuffer SpritePara : register(c0) : slot vs 0
  {
    row_major float4x4 mvp;
    float4 tx;
    float4 ty;

    extern void Set(const sViewport &view)
    {
      mvp = view.ModelScreen;
    }
  };
}

/****************************************************************************/

material SpriteMtrl
{
  vs
  {
    asc vs_2_0                 // hlsl code
    {
      use SpritePara;
      void main
      (
        in float3 in_pos : POSITION,
        in float4 in_color : COLOR0,
        in float2 in_uv0 : TEXCOORD0,
        in float2 in_delta : TEXCOORD1,
        out float2 out_uv0 : TEXCOORD0,
        out float4 out_color : COLOR0,
        out float4 out_pos : POSITION,
      )
      {
        out_uv0 = in_uv0;
        out_color = in_color;
        float3 pos = in_pos + (in_delta.x*tx.xyz) + (in_delta.y*ty.xyz);
        out_pos = mul(float4(pos,1),mvp);
      }
    }
  }

  ps
  {
    asc ps_2_0
    {
      sampler2D s0 : register(s0);
      void main
      (
        in float2 in_uv : TEXCOORD0,
        in float4 in_color : COLOR0,
        out float4 out_col : COLOR0,
      )
      {
        out_col = tex2D(s0,in_uv)*in_color;
      }
    }
    
  }
};

